package com.zlkj.pro.config;

import cn.stylefeng.roses.kernel.file.api.FileOperatorApi;
import com.zlkj.pro.core.file.HuaweiFileOperator;
import com.zlkj.pro.core.file.HuaweiProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * huawei文件配置
 *
 * @author liyang
 * @date 2024/5/8 14:21
 */
@Configuration
public class GunsHuaweiFileConfiguration {

    @Bean
    @ConditionalOnMissingBean(FileOperatorApi.class)
    public FileOperatorApi fileOperatorApi() {
        HuaweiProperties qiNiuProperties = new HuaweiProperties();
//        qiNiuProperties.setEndpoint("https://obs.cn-north-4.myhuaweicloud.com");
        qiNiuProperties.setEndpoint("https://obs.cn-east-3.myhuaweicloud.com");
//        qiNiuProperties.setBucket_endpoint("https://bucket-xd.obs.cn-north-4.myhuaweicloud.com");
        qiNiuProperties.setBucket_endpoint("https://xd-print.obs.cn-east-3.myhuaweicloud.com");
        qiNiuProperties.setAccessKey("43YLLYVCHO4Q7OXBXBDR");
        qiNiuProperties.setSecretKey("EfcY3F4SvIuhnGuyOVWmTYTOSiY3L4RKtoxao98y");
        //qiNiuProperties.setZone(Region.huabei());
        return new HuaweiFileOperator(qiNiuProperties);
    }

}
